<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of UserRepository)" %>

<%@ Import Namespace="SurvivorPool" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Survivor Pool - Users
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table class="data-table">
        <tr>
            <th scope="col">Display Name</th>
            <th scope="col" colspan="4">Picks for Round 1</th>
            <th scope="col" colspan="2">Round 2</th>
            <th scope="col">Rd 3</th>
            <th scope="col">Rd 4</th>
            <th scope="col">Rd 5</th>
            <th scope="col">Rd 6</th>
        </tr>
        <% 
            Dim rowCount As Integer = 0
            For Each item In Model.UserPicksList
                If rowCount Mod 2 = 0 Then Response.Write("<tr>") Else Response.Write("<tr class=""row-alternating"">")
               
                Response.Write("<th scope=""row""><b>" & Html.Encode(item.User.DisplayName) & "</b></th>")

                For Each subItem In item.Picks
                    If subItem.Team IsNot Nothing Then
                        Dim result As TeamObj.TeamResult = subItem.Team.ResultForRound(subItem.BracketRound)
                        If (subItem.BracketRound = GlobalController.FindCurrentRound()) Then
                            If result = TeamObj.TeamResult.Won Then
                                Response.Write("<td style=""background:green""><font color=""white"">" & Html.Encode(subItem.TeamDisplayWithRegion) & "</font>")
                            ElseIf result = TeamObj.TeamResult.Loss Then
                                Response.Write("<td style=""background:#FF303A""><font color=""white"">" & Html.Encode(subItem.TeamDisplayWithRegion) & "</font>")
                            Else
                                Response.Write("<td>")
                                Response.Write(Html.Encode(subItem.TeamDisplayWithRegion))
                            End If
                        Else
                            If result = TeamObj.TeamResult.Won Then
                                Response.Write("<td><font color=""green"">" & Html.Encode(subItem.TeamDisplayWithRegion) & "</font>")
                            ElseIf result = TeamObj.TeamResult.Loss Then
                                Response.Write("<td><font color=""red"">" & Html.Encode(subItem.TeamDisplayWithRegion) & "</font>")
                            Else
                                Response.Write("<td>")
                                Response.Write(Html.Encode(subItem.TeamDisplayWithRegion))
                            End If
                        End If
                    End If
                    Response.Write("</td>")
                Next
                 
                Response.Write("</tr>")
                rowCount += 1
            Next
        %>
    </table>
</asp:Content>
